package Jastermind;

import Various.SerialisationXML;
import Various.Tools;
import java.util.ArrayList;

public class Data{
    private ArrayList<Player> listPlayers;
    private ArrayList<Game> listGames;
    private static Data instanceData=null;

    private Data(){
        this.listPlayers=Tools.listToPlayersList(SerialisationXML.loadFromXml(Player.getFileName()));
        this.listGames=Tools.listToGamesList(SerialisationXML.loadFromXml(Game.getFileName()));
    }
    public static synchronized Data getUniqueInstance(){
        if(instanceData==null){
            Data.instanceData=new Data();
        }
        return instanceData;
    }

    public ArrayList<Game> getListGames() {
        return listGames;
    }

    public void setListGames(ArrayList<Game> listGames) {
        this.listGames = listGames;
    }

    public ArrayList<Player> getListPlayers() {
        return listPlayers;
    }

    public void setListPlayers(ArrayList<Player> listPlayers) {
        this.listPlayers = listPlayers;
    }

    


}
